<template>
    <div class="rights">
        <el-table :data="rightsList" stripe border fit style="width: 100%">
            <el-table-column type="index" label="#" fixed></el-table-column>
            <el-table-column prop="authName" label="权限名称"> </el-table-column>
            <el-table-column prop="path" label="路径"> </el-table-column>
            <el-table-column label="权限等级">
                <template v-slot="scope">
                    <el-tag v-if="scope.row.level === '0'">一级</el-tag>
                    <el-tag type="success" v-else-if="scope.row.level === '1'">二级</el-tag>
                    <el-tag type="warning" v-else-if="scope.row.level === '2'">三级</el-tag>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>
<script setup>
    import { reactive } from "vue"
    import {
        ElTable,
        ElTableColumn,
        ElTag,
        ElMessage
    } from "element-plus"
    import {
        quanxianlb
    } from "@/tools/ajax.js" 
    const rightsList = reactive([])
    quanxianlb({
        type: 'list'
    }).then(res=>{
        console.log(res);
        if(res.meta.status == 200){
            ElMessage.success(res.meta.msg)
            rightsList.push(...res.data)
        }else{
            ElMessage.error(res.meta.msg)
        }
    })
</script>
<style scoped lang="scss">
    .el-table{
        height: calc(100vh - 180px);
    }
</style>